import java.util.Arrays;
import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2025-07-03
 * Time: 15:59
 */
public class Test15 {

    public static void rotate(int[] num, int k) {
        Deque<Integer> dq = new LinkedList<>();
        int n = num.length;
        for(int i = 0; i < n; i++) {
            dq.offerFirst(num[i]);
        }
        for(int i = 0; i < k; i++) {
            dq.offerLast(dq.pollFirst());
        }
        for(int i = 0; i < n; i++) {
            num[i] = dq.pollLast();
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[n];
        for(int i = 0; i < n;i++) {
            num[i]  = sc.nextInt();
        }
        int k = sc.nextInt();
        rotate(num,k);
        System.out.println("轮转数组："+ Arrays.toString(num));
    }
}
